<form name="searchForm" role="form" [formGroup]="formModel" (ngSubmit)="onSeach()" novalidate>
  <div class="form-group" [class.has-error]="formModel.hasError('minlength','title')">
    <label for="productTitle">
      商品名称:
    </label>
    <input formControlName="title" type="text" id="productTitle" placeholder="商品名称">
    <span class="help-block" [class.hidden]="!formModel.hasError('minlength','title')">
      请至少输入三个字
    </span>
  </div>
  <div class="form-group" [class.has-error]="formModel.hasError('positiveNumber','price')">
    <label for="productPrice">
      商品价格:
    </label>
    <input formControlName="price" type="text" id="productPrice" placeholder="商品价格">
    <span class="help-block" [class.hidden]="!formModel.hasError('positiveNumber','price')">
      请输入正数
    </span>
  </div>
  <div class="form-group">
    <label for="productCategory">
      商品类别:
    </label>
    <select formControlName="category" id="productCategory" class="form-control">
      <option value="-1">全部分类</option>
      <option *ngFor="let category of categories" [value]="category">{{category}}</option>
    </select>
  </div>
  <div class="form-group">
    <button type="submit" class="btn btn-primary btn-block">提交</button>
  </div>
</form>